package org.example;


//创建伐木工类，实现接口“人”
public class WoodCutter implements Person {
    //私有变量“斧头”
    private Axe axe;
    //为了优化输出，（I‘m改为伐木工的编号）
    private String nameId;
    private int age;
    private String born;

    //编写伐木工的构造方法（空参）
    public WoodCutter() {

    }

    // 构造注入方法
    //编写伐木工的构造方法（有参）
    public WoodCutter(Axe axe, String nameId,int age,String born) {
        this.axe = axe;
        this.nameId = nameId;
        this.age=age;
        this.born=born;
    }

    // 设置注入所需的getAxe方法
    public Axe getAxe() {
        return this.axe;
    }

    // 设置注入所需的setAxe方法
    public void setAxe(Axe axe) {
        this.axe = axe;
    }

    public String getNameId() {
        return nameId;
    }

    public void setNameId(String nameId) {
        this.nameId = nameId;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getBorn() {
        return born;
    }

    public void setBorn(String born) {
        this.born = born;
    }

    //创建伐木工的方法“使用（某种）斧头”
    public void useAxe() {
        /*实例输出
        i'm going to use axe cut woods.
        we use STONE axe to chop.
        i'm cutter1_2, 12 years old. born in 2012.1.1
        * */
        System.out.println(this.getNameId() + " going to use " + this.getAxe().name() + " cut woods.");
        System.out.println(axe.chop());
        System.out.println("i'm "+this.getNameId()+", "+this.getAge()+" years old. born in "+this.getBorn());
    }

}